package com.smartpro.mis.modular.system.dao;

import com.smartpro.mis.modular.business.neo4jEntity.ClickDistributorRelationship;
import com.smartpro.mis.modular.business.neo4jEntity.N4jDistributor;
import org.springframework.data.neo4j.annotation.Query;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import org.springframework.data.neo4j.repository.Neo4jRepository;
import org.springframework.data.repository.query.Param;


/**
 * @author Mengiy
 */
@RepositoryRestResource(collectionResourceRel = "clickDistributorRelationship", path = "clickDistributorRelationship")
public interface ClickDistributorRelationRepository extends Neo4jRepository<ClickDistributorRelationship, Long> {

    @Query("MATCH (m:N4jDistributor)<-[r:clickDistributorRelationship]-(a:N4jUser) where a.userID = {userID} RETURN m.distributorID")
    int getDistributorID(@Param("userID") int userID);

}